package io;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

/**
 * @description: TODO
 * @author yumo
 * @version: 1.0
 * @date 2025/3/15 10:32
 */
public class ReadStringDemo {
    public static void main(String[] args) throws IOException {
        File file=new File("demo.txt");
        FileInputStream fos=new FileInputStream(file);
        byte[]data=new byte[(int)file.length()];
        fos.read(data);
        String line=new String(data, StandardCharsets.UTF_8);
        System.out.println(line);
        fos.close();
    }
}
